unit Recivie;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    procedure AppMessage(var Msg: TMsg; var Handled: Boolean);
  protected
    procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

procedure TForm1.WMCopyData(var Message: TWMCopyData);
begin
  ShowMessage(PChar(Message.CopyDataStruct.lpData));
end;

procedure TForm1.AppMessage(var Msg: TMsg; var Handled: Boolean);
begin
  if Msg.message = WM_COPYDATA then
  begin
    ShowMessage('iiii');
  end;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  Application.OnMessage := AppMessage;
end;

end.
